package com.bawei.model_sevent.Activity.Http;

import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * 时间：2021/11/11 15:10.
 * 类名：Http_Slings
 * 作用：网络框架的封装
 * 作者:张羽_zy
 */
public class Http_Slings {
    private static Http_Slings http_slings;

    public static Http_Slings getInstance() {
        if (http_slings==null)
        {
            synchronized (Http_Slings.class)
            {
                http_slings=new Http_Slings();
            }
        }
        return http_slings;
    }
    public Retrofit getDate(String url)
    {
        return new Retrofit.Builder()
                .baseUrl(url)
                .client(new OkHttpClient.Builder()
                        .addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY))
                        .build())
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }
}
